package com.corewillsoft.fireflies.storage.objects;

import android.content.ContentValues;

import com.corewillsoft.fireflies.storage.entries.MapLevelEntries;

public class MapLevel implements IContentValuesConvertable {

	private final int level;
	private final Coordinate coordinate;
	private final String imageRef;
	private float width;
	private float height;

	public MapLevel(int level, int x, int y, int width, int height, String imageRef) {
		this.level = level;
		this.coordinate = new Coordinate(x, y);
		this.imageRef = imageRef;
		this.width = width;
		this.height = height;
	}

	@Override
	public String toString() {
		return "MapLevel [level=" + level + ", coordinate=" + coordinate
				+ ", imageRef=" + imageRef + ", width " + width + ", height="  + height + "]";
	}

	public int getLevel() {
		return level;
	}

	public Coordinate getCoordinate() {
		return coordinate;
	}

	public String getImageRef() {
		return imageRef;
	}

	@Override
	public ContentValues toContentValues() {
		ContentValues cv = new ContentValues();
		cv.put(MapLevelEntries.LEVEL, level);
		cv.put(MapLevelEntries.X, coordinate.getX());
		cv.put(MapLevelEntries.Y, coordinate.getY());
		cv.put(MapLevelEntries.WIDTH, width);
		cv.put(MapLevelEntries.HEIGHT, height);
		cv.put(MapLevelEntries.IMAGE_REF, imageRef);

		return cv;
	}

	public float getWidth() {
		return width;
	}

	public float getHeight() {
		return height;
	}
}
